import Fields from 'dependencies/Fields'
import Field from 'dependencies/Field'
import DetailImgs  from 'modules/component/DataView/DetailImgs'
import { UniImageUpload } from 'modules/component/upload'
import priceConfig from 'pages/ai-tool/components/priceConfig'


export const user_id = new Field({
  prop: 'user_id',
  label: '用户ID',
  required: true
})
export const mobile = new Field({
  prop: 'userInfo',
  label: '用户手机号',
  required: true
})
export const tool_id = new Field({
  prop: 'tool_id',
  label: '工具ID',
  required: true
})

export const expiration_time = new Field({
  prop: 'expiration_time',
  label: '过期时间',
  required: true
})

export const buyTime = new Field({
  prop: 'buyTime',
  label: '购买时间'
})

export const tableFields = Object.freeze([
  user_id,
  mobile.setListComponent({
    props: {
      value: Object
    },
    render(h) {
      return  h(
        'span',
        (this.value && this.value.mobile)
      )
    }
  }),
  tool_id,
  expiration_time.setListComponent({
    props: {
      value: Number
    },
    render(h) {
      return h(
        'span',
        (this.value &&
          vk.pubfn.timeFormat(new Date(this.value), 'yyyy-MM-dd hh:mm:ss')) ||
          '--'
      )
    }
  }),
  buyTime.setListComponent({
    props: {
      value: Number
    },
    render(h) {
      return h(
        'span',
        (this.value &&
          vk.pubfn.timeFormat(new Date(this.value), 'yyyy-MM-dd hh:mm:ss')) ||
          '--'
      )
    }
  })
])

export const queryListFields = [
  user_id
]
export const columns = [{
    key: "user_id",
    title: "user_id",
    type: "text"
  },
  {
      key: "tool_id",
      title: "tool_id",
      type: "text"
    }
]